<template>
  <div class="lnrzyyjkfw">
    <p class="top">
      <span style="font-weight: 700; font-size: 16px; color: #000">{{
        info.residentName
      }}</span>
      <span style="display: inline-block; margin: 0 20px"
        >证件号：{{ info.idNo }}</span
      >
      <span>填表人：{{ info.createUserId }}</span>
    </p>
    <div class="tab1">
      <table border="1" cellspacing="0" style="width: 100%" @click="sum_total">
        <tr>
          <th colspan="6" style="padding: 15px">
            <span style="font-weight: 900; font-size: 22px; color: #000"
              >老年人生活自理能力自我评估</span
            >
          </th>
        </tr>
        <tr>
          <th>评估事项</th>
          <th>可自理</th>
          <th>轻度依赖</th>
          <th>中度依赖</th>
          <th>不能自理</th>
          <th>判断评分</th>
        </tr>
        <tr>
          <td>（1）进餐：使用餐具将饭菜送入口、咀嚼、吞咽等活动</td>
          <td>
            <el-radio v-model="info.eatScore" label="0" value="0"
              >独立完成(0分)</el-radio
            >
          </td>
          <td>-</td>
          <td>
            <el-radio v-model="info.eatScore" label="3" value="3"
              >需要协助，如切碎、搅拌食物等(3分)</el-radio
            >
          </td>
          <td>
            <el-radio v-model="info.eatScore" label="5" value="5"
              >完全需要帮助(5分)</el-radio
            >
          </td>
          <td>
            <el-input
              type="number"
              v-model="info.eatScore"
              size="small"
            ></el-input>
          </td>
        </tr>
        <tr>
          <td>（2）梳洗：梳头、洗脸、刷牙、剃须、洗澡等活动</td>
          <td>
            <el-radio v-model="info.washScore" label="0" value="0"
              >独立完成(0分)</el-radio
            >
          </td>
          <td>
            <el-radio v-model="info.washScore" label="1" value="1"
              >能独立地洗头、梳头、洗脸、刷牙、剃须等；洗澡需要协助(1分)</el-radio
            >
          </td>
          <td>
            <el-radio v-model="info.washScore" label="3" value="3"
              >在协助下和适当的时间内，能完成部分梳洗活动(3分)</el-radio
            >
          </td>
          <td>
            <el-radio v-model="info.washScore" label="7" value="7"
              >完全需要帮助(7分)</el-radio
            >
          </td>
          <td>
            <el-input
              type="number"
              v-model="info.washScore"
              size="small"
            ></el-input>
          </td>
        </tr>
        <tr>
          <td>（3）穿衣：穿衣裤、袜子、鞋子等活动</td>
          <td>
            <el-radio v-model="info.dressScore" label="0" value="0"
              >独立完成(0分)</el-radio
            >
          </td>
          <td>-</td>
          <td>
            <el-radio v-model="info.dressScore" label="3" value="3"
              >需要协助，在适当的时间内完成部分穿衣(3分)</el-radio
            >
          </td>
          <td>
            <el-radio v-model="info.dressScore" label="5" value="5"
              >完全需要帮助(5分)</el-radio
            >
          </td>
          <td>
            <el-input
              type="number"
              v-model="info.dressScore"
              size="small"
            ></el-input>
          </td>
        </tr>
        <tr>
          <td>（4）如厕：小便、大便等活动及自控</td>
          <td>
            <el-radio v-model="info.toiletScore" label="0" value="0"
              >不需协助，可自控(0分)</el-radio
            >
          </td>
          <td>
            <el-radio v-model="info.toiletScore" label="1" value="1"
              >偶尔失禁，但基本上能如厕或使用便具(1分)</el-radio
            >
          </td>
          <td>
            <el-radio v-model="info.toiletScore" label="5" value="5"
              >经常失禁，在很多提示和协助下尚能如厕或使用便具(5分)</el-radio
            >
          </td>
          <td>
            <el-radio v-model="info.toiletScore" label="10" value="10"
              >完全失禁，完全需要帮助(10分)</el-radio
            >
          </td>
          <td>
            <el-input
              type="number"
              v-model="info.toiletScore"
              size="small"
            ></el-input>
          </td>
        </tr>
        <tr>
          <td>（5）活动：站立、室内行走、上下楼梯、户外活动</td>
          <td>
            <el-radio v-model="info.exerciseScore" label="0" value="0"
              >独立完成所有活动(0分)</el-radio
            >
          </td>
          <td>
            <el-radio v-model="info.exerciseScore" label="1" value="1"
              >借助较小的外力或辅助装置能完成站立、行走、上下楼梯等(1分)</el-radio
            >
          </td>
          <td>
            <el-radio v-model="info.exerciseScore" label="5" value="5"
              >借助较大的外力才能完成站立、行走，不能上下楼梯(5分)</el-radio
            >
          </td>
          <td>
            <el-radio v-model="info.exerciseScore" label="10" value="10"
              >卧床不起，活动完全需要帮助(10分)</el-radio
            >
          </td>
          <td>
            <el-input
              type="number"
              v-model="info.exerciseScore"
              size="small"
            ></el-input>
          </td>
        </tr>
        <tr>
          <td colspan="6" style="text-align: center">
            总分：{{
              info.totalScore == "NaN"
                ? "请完成所有选项后评分自动计算"
                : info.totalScore
            }}
            <!-- ，评估结果：不能自理 -->
          </td>
        </tr>
      </table>
    </div>
    <div class="box">
      <span>随访医生：</span>
      <!-- <el-select
        filterable
        placeholder="请选择随访医生"
        size="small"
        style="width: 200px"
        v-model="info.createUnitId"
      >
        <el-option label="测试" value="测试"> </el-option>
      </el-select>
      <el-select
        filterable
        placeholder="请选择随访医生"
        size="small"
        style="width: 200px; margin-left: 20px"
        v-model="info.createUserId"
      >
        <el-option label="测试" value="测试"> </el-option>
      </el-select> -->
      <el-input
        placeholder=""
        v-model="info.checkDoctor"
        style="width: 220px"
        size="small"
      >
        <!-- <template slot="append">℃</template> -->
      </el-input>
    </div>
    <div class="box">
      <span>填表日期：</span>
      <el-date-picker
        v-model="value2"
        align="right"
        type="date"
        placeholder="选择日期"
        :picker-options="pickerOptions"
        size="small"
      >
      </el-date-picker>
    </div>
    <div class="box">
      <span>随访照片：</span>
      <el-button
        icon="el-icon-upload2"
        type="primary"
        style="background-color: #fff; color: rgb(46, 160, 254)"
        size="small"
        plain
        >本地上传文件</el-button
      >
      <el-button
        icon="el-icon-picture-outline"
        type="primary"
        style="background-color: #fff; color: rgb(46, 160, 254)"
        size="small"
        plain
        >加载手机图片</el-button
      >
      <p>
        扫描二维码，在手机端点击"上传"图片，在手机端上传后，点击上方"加载手机照片"按钮，即可同步到电脑端
      </p>
      <div>
        <img
          style="width: 100px"
          src="http://8.218.107.5:9992/media/base/zhengjian/qrcode/16863931874Q68253F.png"
          alt=""
        />
        <img
          style="width: 100px; margin-left: 20px"
          src="http://8.218.107.5:9992/media/base/zhengjian/qrcode/16863931874Q68253F.png"
          alt=""
        />
      </div>
    </div>
  </div>
</template>
  
  <script>
export default {
  data() {
    return {
      info: {
        hospitalId: "3015",
        idNo: localStorage.getItem('idCard'),
        residentName: "测试患者",
      },
      options: [
        {
          value: "测试",
          label: "测试",
        },
      ],
      pickerOptions: {
        
        shortcuts: [
          {
            text: "今天",
            onClick(picker) {
              picker.$emit("pick", new Date());
            },
          },
        ],
      },
      value2: "",
    };
  },
  watch: {
    info: {
      handler(newVal, oldVal) {
        this.sum_total();
      },
    },
  },
  methods: {
    sum_total() {
      this.info.totalScore = 0;
      const eatScore = Number(this.info.eatScore) ? Number(this.info.eatScore) : 0;
      const dressScore = Number(this.info.dressScore) ? Number(this.info.dressScore) : 0;
      const exerciseScore = Number(this.info.exerciseScore) ? Number(this.info.exerciseScore) : 0;
      const toiletScore = Number(this.info.toiletScore) ? Number(this.info.toiletScore) : 0;
      const washScore = Number(this.info.washScore) ? Number(this.info.washScore) : 0;
      this.info.totalScore =
        eatScore + dressScore + exerciseScore + toiletScore + washScore;
    },
    btn_ok() {
      var url = this.info.id
        ? "/selfCareAbility/modify"
        : "/selfCareAbility/add";
      var date = new Date();
      this.info.id
        ? (this.info.updatetime = date)
        : (this.info.createtime = date);
      this.$post(url, this.info).then((res) => {
        if (res.code == 400) {
          this.$message({
            message: res.message,
            type: "error",
          });
          return;
        }
        this.$message({
          message: "操作成功",
          type: "success",
        });
      });
    },
    getInfo(item) {
      this.isLoading = true;
      this.info = item;
      this.isLoading = false;
    },
    clear_info() {
      this.info = {
        hospitalId: "3015",
        idNo: localStorage.getItem('idCard'),
        residentName: "测试患者",
      };
    },
  },
};
</script>
  
  <style scoped lang="scss">
.lnrzyyjkfw {
  .top {
    padding: 10px 20px;
    background-color: #e6f7ff;
    border: 1px solid #91d5ff;
  }
  .tab1 {
    tr {
      width: 100%;
      th {
        text-align: center;
        color: #000;
        background-color: rgb(250, 250, 250);
      }
      td {
        padding: 10px;
      }
    }
  }
  .box {
    padding: 10px 250px;
    background-color: rgb(250, 250, 250);
    margin: 10px 0;
  }
}
</style>